package com.xzy.fruitmall.impl;

import com.xzy.fruitmall.GoodsService;
import com.xzy.fruitmall.entity.GoodsInfo;
import com.xzy.fruitmall.mapper.GoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<GoodsInfo> findAllGoods() {
        return goodsMapper.findAllGoods();
    }

    @Override
    public List<GoodsInfo> findGoodsByName(String goodsName) {
        return goodsMapper.findGoodsByName(goodsName);
    }

    @Override
    public void deleteGoodsById(int goodsId) {
        goodsMapper.deleteGoodsById(goodsId);
    }

    @Override
    public GoodsInfo findGoodsById(int goodsId) {
        return goodsMapper.findGoodsById(goodsId);
    }

    @Override
    public void addGoods(GoodsInfo gi) {
        goodsMapper.addGoods(gi);
    }

    @Override
    public void updateGoods(GoodsInfo gi) {
        goodsMapper.updateGoods(gi);
    }
}
